package de.armar.belt_timer;

import java.awt.Dimension;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;

import layout.TableLayout;

public class BeltTimer extends JFrame {
	private static final long serialVersionUID = 1L;
	private JPanel mainPane;
	private MenuPane menu;
	private BeltButtonPane belt_buttons;
	private final double[][] tbsize = new double[][] {
			{
					TableLayout.MINIMUM, TableLayout.FILL
			}, // X
			{
				TableLayout.FILL
			}
	};
	public String mainTitle = "EVE BeltJewTimer (v0.3)";

	public BeltTimer() {
		this.setTitle(mainTitle);
		this.setIconImage(new ImageIcon("./src/de/armar/belt_timer/icons/preferences_system_time.png").getImage());
		this.setContentPane(this.setMainPane(new JPanel()));
		this.menu = new MenuPane(this);
		menu.setMinimumSize(new Dimension(80,1));
		this.setMinimumSize(new Dimension(280,300));
		this.setPreferredSize(new Dimension(280,400));
		this.setLayout(new TableLayout(tbsize));
		this.belt_buttons = new BeltButtonPane(this);
		this.getContentPane().add(menu,"0,0");
		this.getContentPane().add(belt_buttons,"1,0");
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.pack();
		this.setLocationRelativeTo(null);
		this.setVisible(true);
	}

	public void reset() {
		belt_buttons.reset();	
	}

	public void increment() {
		belt_buttons.increment();	
	}

	public void decrement() {
		belt_buttons.decrement();	
	}

	public void checkall() {
		belt_buttons.checkall();
	}

	public JPanel getMainPane() {
		return mainPane;
	}

	public JPanel setMainPane(JPanel mainPane) {
		this.mainPane = mainPane;
		return mainPane;
	}

}
